<div id="divPopUpProduct">
    <fieldset>
        <legend>Search</legend>
        <span class="caption">You can type a part of words</span>
        <?php echo $ajax->form('Product', 'post', array('update' => 'divPopUpProductPaginate', 'indicator' => 'indicator', 'url' => array('action' => 'popup_paginate'))); ?>
        <table>
            <tr>
                <td width="120"><?php echo $form->label('CustProductSite.stock_code'); ?></td>
                <td><?php echo $form->text('CustProductSite.stock_code'); ?></td>
                <td width="120px"><?php echo $form->label('Product.category_id', 'Category'); ?></td>
                <td><?php echo $form->select('Product.category_id', $categories, null); ?></td>
            </tr>
            <tr>
                <td><?php echo $form->label('Product.part_no', 'Vendor Part no.'); ?></td>
                <td><?php echo $form->text('Product.part_no'); ?></td>
                <td><?php echo $form->label('Product.model'); ?></td>
                <td><?php echo $form->text('Product.model'); ?></td>
            </tr>
            <tr>
                <td class="top"><?php echo $form->label('Product.text', 'Description'); ?></td>
                <td colspan="3"><?php echo $form->text('Product.text', array('size' => 120)); ?></td>
            </tr>
            <tr>
                <td class="top"><?php echo $form->label('CustProductSite.dispatch_from', 'Dispatch From'); ?></td>
                <td>
                    <?php echo $form->radio('CustProductSite.dispatch_from', array(ITS_PREFIX => 'ITS', SUPPLIER_PREFIX => 'Other Vendor', '' => 'All'), array('legend' => false)); ?>
                    <br />
                    <?php echo $form->select('CustProductSite.supplier_id', $suppliers, null, array('style' => 'display: none;')); ?>
                </td>
                <td><?php echo $form->label('Product.brand_id', 'Brand'); ?></td>
                <td>
                    <?php echo $form->select('Product.brand_id'); ?>
                    <?php echo $form->submit('icon/search.png', array('id' => 'submit', 'style' => 'display: inline;')); ?>
                </td>
            </tr>
        </table>
        <?php echo $form->end(); ?>
                </fieldset>
                <div id="divPopUpProductPaginate">
        <?php echo $this->requestAction('cust_product_sites/popup_paginate', array('return')); ?>
                </div>
            </div>

            <div class="hide">
    <?php echo $form->select('its_brand_id', $itsBrands, null, array('disabled' => true)); ?>
    <?php echo $form->select('supplier_brand_id', $supplierBrands, null, array('disabled' => true)); ?>
</div>

<script type="text/javascript">
    $j(function() {
        $j(':radio').bind('click', function() {
            var dispatch_from = $j(this).val();
            if (dispatch_from == SUPPLIER_PREFIX) {
                $j('#CustProductSiteSupplierId').show();
                $j('#ProductBrandId').html($j('#supplier_brand_id').html());
            } else {
                $j('#CustProductSiteSupplierId').hide().val('');
                $j('#ProductBrandId').html($j('#its_brand_id').html());
            }
        });


        $j('#CustProductSiteSupplierId').bind('change', function() {
            $j('#ProductBrandId').requestOptions('cust_product_sites/option_vendor_brand_list', $j(this).val(), {empty_option: '--All--'});
        });

        $j(':radio[id=CustProductSiteDispatchFrom]').click()
    })
</script>